home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / SecalDemo / Projects / Tutorials / x_AnimDemo.scl < prev    next >
Text File  |  1998-06-24  |  2KB  |  58 lines

  1. /******************************************************************************\
  2. **  Anim example (uses the Extension) for Secal                               **
  3. **  Requires Kickstart 2                                                      **
  4. \******************************************************************************/
  5.  
  6.  
  7. go main;                                    # EXECUTION STARTS AT THE BEGINNING OF THE
  8.                                                     # PROGRAM, GO TO THE MAIN CODE
  9.  
  10.  
  11. include "ext/ext.inc";        # COMPILE THE HEADER INTERFACE FOR EXTENSION TOO
  12. inclib "ext/ext.lib";            # USE EXT.LIB AS A LINK LIBRARY
  13.  
  14.  
  15. main:                                            # MAIN ENTRY POINT
  16. push d2\a2\a3;                        # SAVE MODIFIED NONVOLATILE REGISTERS
  17.  
  18. x_Init;                                        # INITIALIZE EXTENSION
  19. if d0 then
  20.     x_GraphicsStart;                # START GRAPHICS SUBSYSTEM
  21.     if d0 then
  22.         x_Ani_Load("data/demo.anim",-1); a2:=a0;
  23.                                                 # LOAD AND INIT ANIM, STORE PTR IN A2
  24.         if a2 then
  25.             x_Scr_Open(x_ani(a2).camg,x_ani(a2).width,x_ani(a2).height,x_ani(a2).depth,0,a1,0);
  26.                                                 # OPEN SCREEN, WIDTH, HEIGHT, DEPTH, ETC. TAKEN
  27.                                                 # FROM X_ANI STRUCTURE, COLORS (RGB8) ALSO RETURNED
  28.             a3:=a0;                                    # STORE PTR IN A3
  29.             if a3 then
  30.                 x_Scr_AddBmp(a3);    # ADD ANOTHER BITMAP FOR DOUBLE BUFFERING
  31.                 if d0 then
  32.                     x_SetTaskPri(0,31);        # RAISE TASK PRI FOR SMOOTH ACTION
  33.  
  34.                     d2:=0;
  35.                     repeat
  36.                         d2:=d2 xor 1;            # IDENTIFIES WORK BUF
  37.                         x_Scr_GetBmp(a3,d2);        # GET WORK BITMAP POINTER
  38.                         x_Ani_DoFrame(a2,a0,0,0,a3);    # RENDER ANIM FRAME
  39.                         x_Scr_ActivateBmp(a3,d2,-1,-1);    # SWITCH SCR BUFFERS, THIS WILL
  40.                                                             # ALSO WAIT FOR NEXT FRAME
  41.                     until [$dff016] and $400=0;    # DIRTY CHECK FOR RIGHT MOUSE BUTTON
  42.  
  43.                     x_RevertTaskPri;            # REVERT TO PREVIOUS PRI
  44.                 ;
  45.             ;
  46.         ;
  47.     ;
  48.     x_Done;                                # SHUT DOWN EXTENSION. THIS FUNCTION WILL ALSO FREE
  49.                                                 # EVERYTHING ALLOCATED THRU THE EXTENSION, WHICH WE
  50.                                                 # DIDN'T FREE ALLREADY (SCREENS, MUSIC, ANIMS, ETC.)
  51. ;
  52.  
  53. d0.l:=0;                                # RETURN CODE FOR DOS
  54.  
  55. pop d2\a2\a3;                        # RESTORE NONVOLATILE REGISTERS
  56. rts;                                        # RETURN
  57.  
  58.